<?php
namespace app\admin\controller;

class Setting extends Admin{
    public function __construct(){
        parent::__construct();
        $this->model = "Config";
        $this->assign("model",$this->model);
    }
    public function index(){
        return $this->fetch();
    }
    public function save_config(){
        $configarr = input("post.config/a");
        foreach($configarr as $k => $v){
            model("Config")->where(['name'=>$k])->update(['value'=>$v]);
        }
        $config = model('Config')->lists();
        cache('DB_CONFIG_DATA',$config);
        return json(['status' => 1,'msg'=>'操作成功']);
    }
}